VERSION 5.00
Begin VB.Form TextEntry 
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Text"
   ClientHeight    =   3312
   ClientLeft      =   36
   ClientTop       =   264
   ClientWidth     =   4356
   ControlBox      =   0   'False
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   3312
   ScaleWidth      =   4356
   ShowInTaskbar   =   0   'False
   StartUpPosition =   1  'CenterOwner
   Begin VB.CommandButton Command4 
      Caption         =   "Background color"
      Enabled         =   0   'False
      Height          =   312
      Left            =   1200
      TabIndex        =   6
      Top             =   1320
      Width           =   1572
   End
   Begin VB.CommandButton Command3 
      Caption         =   "Font"
      Height          =   312
      Left            =   1200
      TabIndex        =   5
      Top             =   180
      Width           =   852
   End
   Begin VB.OptionButton Option2 
      Caption         =   "Solid"
      Height          =   252
      Left            =   1200
      TabIndex        =   4
      Top             =   960
      Value           =   -1  'True
      Width           =   1692
   End
   Begin VB.OptionButton Option1 
      Caption         =   "Transparent"
      Height          =   252
      Left            =   1200
      TabIndex        =   3
      Top             =   600
      Width           =   1632
   End
   Begin VB.TextBox Text2 
      Height          =   1392
      Left            =   240
      MultiLine       =   -1  'True
      ScrollBars      =   3  'Both
      TabIndex        =   0
      Top             =   1740
      Width           =   3852
   End
   Begin VB.CommandButton Command2 
      Cancel          =   -1  'True
      Caption         =   "Cancel"
      Height          =   432
      Left            =   3360
      TabIndex        =   2
      Top             =   960
      Width           =   732
   End
   Begin VB.CommandButton Command1 
      Caption         =   "OK"
      Height          =   432
      Left            =   3360
      TabIndex        =   1
      Top             =   360
      Width           =   732
   End
   Begin VB.Label Label1 
      Caption         =   "Text:"
      Height          =   252
      Left            =   180
      TabIndex        =   7
      Top             =   1500
      Width           =   612
   End
End
Attribute VB_Name = "TextEntry"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit

Dim textfore&
Dim textback&
Private Sub Command1_Click()
    '--------------------------------------------------
    'Make the label on the main form correspond to the
    'properties set in this dialog.
    '--------------------------------------------------
    Form1.Label1.Caption = Text2
    If Option1 Then
        Form1.Label1.BackStyle = vbTransparent
    Else
        Form1.Label1.BackStyle = vbBSSolid
    End If
    Form1.Label1.ForeColor = Text2.ForeColor
    Form1.Label1.BackColor = textback
    Form1.Label1.Font.Name = Text2.Font.Name
    Form1.Label1.Font.Size = Text2.Font.Size
    Form1.Label1.Font.Bold = Text2.Font.Bold
    Form1.Label1.Font.Underline = Text2.Font.Underline
    Form1.Label1.Font.Weight = Text2.Font.Weight
    Form1.Label1.Font.Italic = Text2.Font.Italic
    Form1.Label1.Font.Strikethrough = Text2.Font.Strikethrough
    
    Unload Me
End Sub

Private Sub Command2_Click()
    Unload Me
End Sub


Private Sub Command3_Click()
    '------------------------------------------------------
    'Call the commmon dialog's Font dialog
    '------------------------------------------------------
    Dim objFontDialog As New clsCommonDialog
    objFontDialog.HookAddress = pAddressOf(AddressOf FontProc)
    objFontDialog.FLAGS = cdlCFEnableHook Or cdlCFScreenFonts Or cdlCFTTOnly
    objFontDialog.CancelError = True
    objFontDialog.FontBold = Text2.FontBold
    objFontDialog.FontItalic = Text2.FontItalic
    objFontDialog.FontName = Text2.FontName
    objFontDialog.FontSize = Text2.FontSize
    objFontDialog.FontStrikethru = Text2.FontStrikethru
    objFontDialog.FontUnderline = Text2.FontUnderline
    objFontDialog.Color = Text2.ForeColor
    objFontDialog.hwnd = hwnd
    objFontDialog.ShowFont
    If objFontDialog.APIReturn = False Then
        Set objFontDialog = Nothing
        Exit Sub
    End If
    'On Error Resume Next
    Text2.FontName = objFontDialog.FontName
    Text2.FontSize = objFontDialog.FontSize
    Text2.FontStrikethru = objFontDialog.FontStrikethru
    Text2.FontUnderline = objFontDialog.FontUnderline
    Text2.FontBold = objFontDialog.FontBold
    Text2.FontItalic = objFontDialog.FontItalic
    Text2.ForeColor = objFontDialog.Color
    Set objFontDialog = Nothing
End Sub

Private Sub Command4_Click()
    Dim objColorDialog As New clsCommonDialog
    objColorDialog.FLAGS = CC_ENABLEHOOK
    objColorDialog.HookAddress = pAddressOf(AddressOf colorProc)
    objColorDialog.Color = textback
    'objColorDialog.hwnd = hwnd
    objColorDialog.ShowColor
    textback = objColorDialog.Color
    Text2.BackColor = textback
    Set objColorDialog = Nothing
End Sub
Private Sub Form_Load()
    '----------------------------------------------
    'Initialize the text box to match the main form's
    'label properties.
    '----------------------------------------------
    Text2 = Form1.Label1.Caption
    Text2.Font.Bold = Form1.Label1.Font.Bold
    Text2.Font.Italic = Form1.Label1.Font.Italic
    Text2.Font.Name = Form1.Label1.Font.Name
    Text2.Font.Size = Form1.Label1.Font.Size
    Text2.Font.Strikethrough = Form1.Label1.Font.Strikethrough
    Text2.Font.Underline = Form1.Label1.Font.Underline
    Text2.Font.Weight = Form1.Label1.Font.Weight
    textback = Form1.Label1.BackColor
    If Form1.Label1.BackStyle = vbTransparent Then
        Option1.Value = True
        Text2.BackColor = Form1.BackColor
    Else
        Option2.Value = True
        Text2.BackColor = textback
        Command4.Enabled = True
    End If
    Text2.ForeColor = Form1.Label1.ForeColor
End Sub
Private Sub Option1_Click()
    Text2.BackColor = Form1.BackColor
    Command4.Enabled = False
End Sub
Private Sub Option2_Click()
    Text2.BackColor = textback
    Command4.Enabled = True
End Sub


